import { pageToLogin } from '@/base/http/utils';
import { getMyPageUserInfo } from '@/business/services/user/userInfo';
import { View } from '@tarojs/components';
import Taro, { useDidShow, useLoad } from '@tarojs/taro';
import { useState } from 'react';

/**
 * @description 聊天中转业
 * @author Shawn
 */

export default function ChatBlank() {

    const [state, setState] = useState(false);

    useLoad(() => {

    })

    useDidShow(async () => {
        const res = await getMyPageUserInfo()
        console.log('useDidShow chatblank ', res);
        if (!res.success) {
            pageToLogin()
            return
        }
        if (state) {
            Taro.switchTab({
                url: `/pages/index/index`,
            })
            setState(false)
        } else {
            Taro.navigateTo({
                url: `/subPackages/chat/index`,
            })
            setState(true)
        }

    })

    return (
        <View>
        </View>
    );
}
